﻿using System.Collections;
using System.Runtime.Serialization;

namespace FlyearAssist.Hibernating.DataModel
{
    [System.Runtime.Serialization.DataContract(
        Namespace = "http://NHibernateAssist.Flyear/DataModel",
    IsReference = true)]
    public class PageInfo
    {
        public PageInfo() { }

        public PageInfo(System.Type entityType, int pageIndex)
        {
            this._entityType = entityType;
            this._pageIndex = pageIndex;
        }

        public PageInfo(System.Type entityType, int pageIndex, params NCondition[] conditions)
        {
            this._entityType = entityType;
            this._pageIndex = pageIndex;
            this._conditions = conditions;
        }

        public PageInfo(System.Type entityType, int pageIndex, NCondition[] conditions, NOrder[] orders)
        {
            this._entityType = entityType;
            this._pageIndex = pageIndex;
            this._conditions = conditions;
            this._orderFields = orders;
        }

        private System.Type _entityType;//类
        [DataMember]
        public System.Type EntityType
        {
            get { return _entityType; }
            set { _entityType = value; }
        }

        [DataMember]
        public string EntityName { get; set; }

        private int _pageIndex = 1;//页号
        [DataMember]
        public int PageIndex
        {
            get { return _pageIndex; }
            set { _pageIndex = value; }
        }

        private NCondition[] _conditions;//条件
        [DataMember]
        public NCondition[] Conditions
        {
            get { return _conditions; }
            set { _conditions = value; }
        }
        private NOrder[] _orderFields;//排序
        [DataMember]
        public NOrder[] OrderFields
        {
            get { return _orderFields; }
            set { _orderFields = value; }
        }
        private int pageSize = 10;
        [DataMember]
        public int PageSize
        {
            get { return pageSize; }
            set { pageSize = value; }
        }


        private int _recordCount;
        [DataMember]
        public int RecordCount
        {
            get { return _recordCount; }
            set { _recordCount = value; }
        }
        private int pageCount;
        [DataMember]
        public int PageCount
        {
            get { return pageCount; }
            set { pageCount = value; }
        }
        private System.Collections.IList list;
        [DataMember]
        public IList List
        {
            get { return list; }
            set { list = value; }
        }
    }

    [System.Runtime.Serialization.DataContract(
        Namespace = "http://NHibernateAssist.Flyear/DataModel", IsReference = true)]
    public class QueryInfo
    {
        public QueryInfo() { }

        public QueryInfo(System.Type entityType)
        {
            this._entityType = entityType;
        }

        public QueryInfo(System.Type entityType, params NCondition[] conditions)
        {
            this._entityType = entityType;
            this._conditions = conditions;
        }

        public QueryInfo(System.Type entityType, NCondition[] conditions, NOrder[] orders)
        {
            this._entityType = entityType;
            this._conditions = conditions;
            this._orderFields = orders;
        }

        private System.Type _entityType;//类
        [DataMember]
        public System.Type EntityType
        {
            get { return _entityType; }
            set { _entityType = value; }
        }

        [DataMember]
        public string EntityName { get; set; }

        private NCondition[] _conditions;//条件
        [DataMember]
        public NCondition[] Conditions
        {
            get { return _conditions; }
            set { _conditions = value; }
        }
        private NOrder[] _orderFields;//排序
        [DataMember]
        public NOrder[] OrderFields
        {
            get { return _orderFields; }
            set { _orderFields = value; }
        }

        private System.Collections.IList list;
        [DataMember]
        public IList List
        {
            get { return list; }
            set { list = value; }
        }
    }
}
